const API_ENVIRONMENT = ({
    test: 'https://ranstoretest.iranboss.com',
    prod: 'https://ranstore.iranboss.com',
})['prod'] || 'https://ranstore.iranboss.com';
//版本号
const VERSION = '0.0.1';
//  uuid 生成随机uuid prod env
const uuid = wx.getStorageSync("uuid");
let generateUUID = () => {
    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
        var r = Math.random() * 16 | 0,
            v = c == 'x' ? r : (r & 0x3 | 0x8);
        return v.toString(16);
    });
};
if (!uuid) {
    wx.setStorageSync('uuid', generateUUID())
}
//trace  标识上游身份
const trace = wx.getStorageSync("trace");
if (!trace) {
    wx.setStorageSync('trace', '');
}
let PLATFORM = '';
wx.getSystemInfo({
    success: function (res) {
        let res_platform = res.platform.toLowerCase()
        if (res_platform == "devtools") {
            PLATFORM = 'pc'
        } else if (res_platform == "ios") {
            PLATFORM = 'ios'
        } else if (res_platform == "android") {
            PLATFORM = 'android'
        }
    }
})
const API = {
    // API_HOST: 'https://apimock.xlemon.cn',
    API_HOST: API_ENVIRONMENT,
    API_VERSION: VERSION,
    API_PLATFORM: PLATFORM,
    URL_GET_TOKEN: "/ranstore/user/miniProgramLogin",
};

module.exports = API